<template>
	<view class="address_info ptb_12 plr_16 pr bc_fff">
		<template v-if="!data||(!data.address&&!data.province)">
			<view class="fx aic ptb_10">
				<uni-icons class="mr_4" custom-prefix="iconfont" type="icon-weizhi_color" color="#F08519"
					size="60rpx"></uni-icons>
				<text class="ml_11 fz_18 fb">设置收货地址</text>
			</view>
		</template>
		<template v-else>
			<view class="fx aic jcb">
				<view class="width_278 flow_h">
					<view class="fx fb">
						<text class="mr_8">{{data.realName||''}}</text>
						<text>{{data.phone||''}}</text>
					</view>
					<view class="mt_4 fc_999 fz_12" v-if="data.address">
						{{data.address}}
					</view>
					<view class="mt_4 fc_999 fz_12" v-else>
						{{data.isDefault==1?'【默认地址】':''}}{{`${data.province}${data.city}${data.district}${data.detail}`}}
					</view>
				</view>
				<u-icon name="arrow-right" color="#333" size="22rpx" v-if="arrow"></u-icon>
			</view>
			<view class="fx grid_12 fz_12 ptb_12 bot_1 boc_grey mt_10" v-if="userType>=5&&userType!=8&&extraData">
				<view class="fx fx_w grid_12 aic img_list">
					<view class="img_wrap fx aic fx_sh" v-if="userType>=5">
						<image class="width_20 height_20 br50 mr_4" :src="getStaticUrl(userInfo.avatar)"
							mode="aspectFit">
						</image>
						<text>{{userInfo.nickname||''}}</text>
					</view>
					<view class="img_wrap fx aic fx_sh" v-if="userType>=6">
						<image class="width_20 height_20 br50 mr_4" :src="getStaticUrl(extraData.salesAvatar)"
							mode="aspectFit">
						</image>
						<text>{{extraData.salesName||''}}</text>
					</view>
					<view class="img_wrap fx aic fx_sh" v-if="userType>=7">
						<image class="width_20 height_20 br50 mr_4" :src="getStaticUrl(extraData.supervisorAvatar)"
							mode="aspectFit">
						</image>
						<text>{{extraData.supervisorName||''}}</text>
					</view>
				</view>
			</view>
		</template>
		<view class="border pa b_0 l_0 r_0 height_2"></view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	import {
		getStaticUrl
	} from '@/utils/index.js'
	export default {
		props: {
			data: {
				type: Object || null,
				default: null
			},
			arrow: {
				type: Boolean,
				default: true
			},
			extraData: {
				type: Object || null,
				default: null
			}
		},
		data() {
			return {

			}
		},
		computed: {
			...mapState(['userType']),
			getStaticUrl() {
				return (src) => getStaticUrl(src)
			},
			userInfo() {
				return (this.extraData && this.extraData.userInfo) ? JSON.parse(this.extraData.userInfo) : {}
			}
		},
		methods: {}
	}
</script>

<style lang="scss" scoped>
	.address_info {
		.border {
			background: repeating-linear-gradient(45deg, #fff, #fff 8rpx, #EF7E6A 8rpx, #EF7E6A 24rpx, #fff 24rpx, #fff 36rpx, #94BAD8 36rpx, #94BAD8 50rpx)
		}

		.img_list {
		}
	}
</style>